package com.cooper.scraper.show;

import com.cooper.android.comm.BitmapUtils;
import com.cooper.scraper.R;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

public class CrystalFanartImgStrategy implements FanartImgStrategy {
	
	private static final float ROUND_RADIUS_SCALE = 15;

	private Bitmap overlay = null;
	
	private float fanartHeight;
	private float fanatrWidth;

	public CrystalFanartImgStrategy(float fanartScale, int parentHeight) {
		super();
		fanartHeight = 3 * parentHeight / 4;
		//for zoom
		fanartHeight = fanartHeight - fanartHeight * 0.1f;
		fanatrWidth = fanartHeight * fanartScale; 
	}

	@Override
	public Bitmap handleFanartImg(Context context, Bitmap fanartImg) {
		if (overlay == null) {
			overlay = BitmapFactory.decodeResource(context.getResources(),
					R.drawable.resource_overlay_crystal);
		}

		return BitmapUtils.reflectedFanart(BitmapUtils.drawOverlay(
				BitmapUtils.roundRect(fanartImg, fanartImg.getWidth()
						/ ROUND_RADIUS_SCALE), overlay, 0, true));
	}

	@Override
	public float getFanartHeight() {
		return fanartHeight;
	}

	@Override
	public float getFanartWidth() {
		return fanatrWidth;
	}

}
